var co = require("gq-core/node_modules/co");
var socket = require("../lib/socket_connect.js");
module.exports = {
    init: function(cb) {
        socket.msgInfo("router-init", {
            info: {
                name: "XUEZI-name",
                author: "XUEZI",
                version: "0.1.0",
                description: "XUEZI-description",
            },
            address: {
                host: "0.0.0.0",
                port: 4001
            },
            initKey: "XUEZI-INIT-KEY-HASH"
        });
        socket.onMsgSuccess("router-init", function(data, done) {
            console.log("路由初始化成功");
            done();
            cb();
        });
        socket.onMsgError("router-init", function(data, done) {
            console.log("路由初始化失败");
            done();
            cb(new Error("路由初始化失败"));
        });
    }
};
